<?php

// 测试请求，请修改此文件

// 入口文件所在目录

define('SWROOT_PATH', dirname(__FILE__));
define('FRAMEWORK_PATH', dirname(dirname(dirname(__FILE__))));

$iniPath = FRAMEWORK_PATH . '/conf/serv_conf.ini';
$config = parse_ini_file($iniPath, true);

$_serverType = $config['LISTENING']['type'];
$_serverPort = $config['LISTENING']['port'];

$data = 'data';
if ($_serverType == 'tcp') {
    if ($config['SETTING']['open_length_check']) {
        $data = pack('N', strlen($data)) . $data;
    }
    $type = SWOOLE_TCP;
} else {
    $type = SWOOLE_UDP;
}

$client = new swoole_client($type);
$client->connect('127.0.0.1', $_serverPort);

$client->send($data);
echo $client->recv();

